<template>
  <div class="learnIndex">
    <div class="top">
      <p class="learn">我的徽章</p>
      <div class="progress">
        <i class="iconfont iconxuanchuan_icon_shoucang"></i>
        <span>已获得&nbsp;{{data.have | two}}&nbsp;/&nbsp;{{data.count | two}}</span>
      </div>
    </div>
    <div class="content1 shadow">
      <div class="content1">
        <div v-for="item of data.info" :key="item.id">
          <div class="titleBox">
            <p class="title">{{item.name}}</p>
            <div>
              <span>{{item.have}}</span>
              <span>/</span>
              <span>{{item.count}}</span>
            </div>
          </div>

          <div class="box">
            <div class="img" v-for="i of item.data" :key="i.id">
              <img v-if="i.is_have==1" :src="i.photo_a" alt>
              <img v-if="i.is_have==0" :src="i.photo_b" alt>
              <p>{{i.title}}</p>
            </div>
          </div>
          <div style="height:40px"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      listData: [],
      data: {}
    };
  },
  mounted() {
    this.$progress.done();
    this.init();
  },
  filters: {
    two: function(e) {
      e = e + "";
      return e.padStart(2, "0");
    }
  },
  methods: {
    init() {
      this.$http
        .get("/applets/My/medal_list", {
          uid: JSON.parse(Cookies.get('user_71ydj')).id
        })
        .then(res => {
          this.data = res.data;
        });
    },

    initData() {
      this.$http.get("/applets/Study/audio_list", {}).then(res => {});
    }
  }
};
</script>

<style scoped lang="scss">
* {
  margin: 0;
  padding: 0;
}
.top {
  position: relative;
  background: url("~@as/img/xuexi_huizhang_bg@2x.png");
  background-size: 100% 100%;
  width: 100%;
  height: 229px;
  
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  z-index: 0;

  .learn {
    color: #fff;
    font-weight: Bold;
    font-size: 28px;
    margin-top: 73px;
    margin-left: 13px;
  }

  .progress {
    margin-left: 16px;
    margin-top: 14px;
    width: 109px;
    height: 22px;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    i {
      color: #ffe789;
      font-size: 10px;
      margin-right: 7px;
    }
    span {
      font-size: 12px;
      color: #fff;
    }
  }
}

.shadow {
  border-radius: 0 0 8px 8px !important;
  top: 229px;
  margin-left: 15px;
  margin-right: 15px;
  margin-top: 0 !important;
  z-index: 99 !important;
  min-height: 62vh !important;
  box-shadow: 0 4px 5px 1px rgba(0, 0, 0, 0.2);
  width:92% !important;
  margin-bottom: 23px !important; 
}
.content1 {
  z-index: 1;
  background: #fff;
  border-radius: 8px;
  min-height: 70vh;
  width: 100%;

  margin-top: -50px;
  margin-bottom: -3px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;

}
.titleBox {
  display: flex;
  height: 55px;
  width: 100%;
  justify-content: space-between;
  align-items: flex-end;
  div {
    font-size: 18px;
    line-height: 20px;
    color: #aaa;
    span {
      font-size: 18px;
      color: #333;
      font-weight: bold;
      margin-left: 5px;
    }
    span + span + span {
      color: #aaa;
      font-size: 15px;
      margin-right: 20px;
    }
  }

  .title {
    font-size: 18px;
    color: #333;
    margin-left: 20px;
    font-weight: bold;
  }
}

.box {
  width: 100%;
  height: auto;

  display: flex;
  flex-wrap: wrap;

  .img {
    margin-left: 21px;
    margin-right: 21px;
    margin-top: 24px;

    width: 71px;
    height: 97px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    img {
      width: 71px;
      height: 69px;
    }
    p {
      width: auto;
      font-size: 14px;
      color: #333;
      white-space: nowrap;
    }
  }
}
.loading {
  width: 100%;
  font-size: 14px;
  color: #dddddd;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
}
</style>